package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Setter@Getter
@JsonIgnoreProperties("handler")
public class StrategyCatalog extends BaseDomain{

    private String name;

    private Long strategyId;

    private String strategyTitle;

    private Integer sequence;

    private boolean state;

    private List<StrategyDetail> details = new ArrayList<>();

    public String getStateName(){
        String msg = "禁用";
        if(state){
            msg = "启用";
        }
        return msg;
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("strategyId",strategyId);
        map.put("strategyTitle",strategyTitle);
        map.put("sequence",sequence);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }

}